package com.telecom.cms.actions;

import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.telecom.cms.dbconnect.Chinese;
import com.telecom.cms.dto.ShowatomDTO;

/**
 * @author yueyingnishang
 *
 */
public class AtomdelAction extends Action {

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		List list = (List) request.getSession().getAttribute("AtomList");
		int atomid = Integer.parseInt(request.getParameter("recordname"));

		for (int j = 0; j < list.size(); j++) {

			ShowatomDTO dto = (ShowatomDTO) list.get(j);
			int aid = dto.getAtomid();
			if (atomid == aid) {

				list.remove(j);
			}
		}
		request.getSession().setAttribute("AtomList", list);

		return mapping.findForward("success");
	}

}
